﻿using MediatR;
using RBAC.MaHaiBo.API.Application.Command.DeepProcessingCommand;
using RBAC.MaHaiBo.Service.TraceabilityService;

namespace RBAC.MaHaiBo.API.Application.CommandHandlers.DeepProcessingHandler
{
    public class updDeepProcessingCommandHandler:IRequestHandler<updDeepProcessingCommand, int>
    {
        /// <summary>
        /// 深加工服务层
        /// </summary>
        IDeepProcessingService service;
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="service">深加工服务层</param>
        public updDeepProcessingCommandHandler(IDeepProcessingService service)
        {
            this.service = service;
        }

        public async Task<int> Handle(updDeepProcessingCommand request, CancellationToken cancellationToken)
        {
            return await service.updDeepProcessing(new Entity.Traceability.DeepProcessing()
            {
                Deepprocessingid = request.Deepprocessingid,
                TeamOrGroup = request.TeamOrGroup,
                Principal = request.Principal,
                LOT = request.LOT,
                Uid = request.Uid,
                UpdName = request.UpdName,
                UpdTime = request.UpdTime
            });
        }
    }
}
